package com.shelpe.services.lexicon.service.filter.support;

import org.springframework.beans.factory.annotation.Autowired;

import com.shelpe.services.lexicon.constants.Device;
import com.shelpe.services.lexicon.entity.AdgroupRecord;
import com.shelpe.services.lexicon.entity.KeywordRecommend;
import com.shelpe.services.lexicon.properties.AutoDriveParams;

public class SimilarityRecommendMetricFilter implements KeywordRecommendFilter {

	@Autowired
	private AutoDriveParams params;

	@Override
	public KeywordRecommend run(KeywordRecommend recommend, AdgroupRecord record, Device device) {
		boolean support = true;
		if(recommend.getProductSimilarity() > 0){
			support = support && recommend.getProductSimilarity() >= params.getLowProductSimilarity();
		}
		if(recommend.getCategorySimilarity() > 0){
			support = support && recommend.getCategorySimilarity() >= params.getLowCategorySimilarity();
		}
		return support?recommend:null;
	}
	
	

}
